home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CONTRSRC.ZIP / SRC / GOPI / TRANSF3.INC < prev    next >
Encoding:
Text File  |  1994-11-17  |  10.4 KB  |  344 lines

  1.  
  2. ;---- dots transf - (C) GOPI/TFL-TDV ----
  3. ; not very optimized but it's GOPY first try in ASM :-)
  4.  
  5. ;     transf3a               ;rotation zx
  6. ;     transf3b               ;rotation zy
  7. ;     transf3c               ;rotation xy
  8. ;*****************************************************************************
  9. transf3a  macro
  10.           local bcl1,fbcl1,Patch
  11.           MPUSH eax,ebx,cx,edx,esi,edi,ebp,es
  12.   
  13.          mov ax,0a000h
  14.          mov es,ax     ; video seg
  15.          mov dx,3c4h
  16.          mov al,2      ; select bitplane
  17.          out dx,al       
  18.  
  19.          mov  ax,savptr
  20.          mov  WORD PTR cs:[Patch+3],ax ; save coord buf
  21.  
  22. ;**************
  23. ;rotation zx
  24. ;**************
  25.          mov  cx,nbdots
  26.          xor  bx,bx
  27. bcl1:    
  28.          ;agrandissement*****
  29.          mov  dl,agr
  30.          mov  al,BYTE PTR gs:XV[bx]
  31.          imul dl
  32.          cwde
  33.          mov  DWORD PTR gs:XV[bx],eax
  34.  
  35.          mov  al,BYTE PTR gs:YV[bx]
  36.          imul dl
  37.          cwde
  38.          mov  DWORD PTR gs:YV[bx],eax
  39.  
  40.          mov  al,BYTE PTR gs:zV[bx]
  41.          imul dl
  42.          cwde
  43.          mov  DWORD PTR gs:zV[bx],eax
  44.          ;*******************
  45.  
  46.          mov    si,agl
  47.          mov    edi,DWORD PTR gs:xv[bx]
  48.          imul   edi,DWORD PTR[cos+si]    ;edi=cos*x
  49.  
  50.          mov    eax,DWORD PTR gs:yv[bx]
  51.          imul   eax,DWORD PTR[sin+si]    ;eax=sin*y
  52.  
  53.          sub    edi,eax          ;edi:=edi-eax
  54.          sar    edi,8            ;edi:=edi /256
  55.          mov    ebp,edi          ; save x
  56.  
  57.          mov    edi,DWORD PTR gs:xv[bx]
  58.          imul   edi,DWORD PTR[sin+si]    ;edi=sin*x
  59.  
  60.          mov    eax,DWORD PTR gs:yv[bx]
  61.          imul   eax,DWORD PTR[cos+si]    ;eax=cos*y
  62.  
  63.          add    edi,eax         ;edi=edi+esi
  64.          sar    edi,8           ;edi=edi /256
  65.          mov    DWORD PTR gs:yv[bx],edi ;y=ok
  66.  
  67.          mov    DWORD PTR gs:xv[bx],ebp ;x=ok
  68.  
  69.          mov    edi,DWORD PTR gs:yv[bx]
  70.          imul   edi,DWORD PTR[cos+si]    ;edi=cos*y
  71.          mov    eax,DWORD PTR gs:zv[bx]
  72.          imul   eax,DWORD PTR[sin+si]    ;eax=sin*z
  73.          sub    edi,eax         ;edi=edi-eax
  74.          sar    edi,8           ;edi=edi /256
  75.          mov    DWORD PTR gs:yv[bx],edi ;y=ok
  76.  
  77.          ;viewdots**********************************************
  78.          mov  edi,DWORD PTR gs:XV[bx] ; x
  79.          add  edi,160
  80. ;         cmp  edi,0         ;clip
  81. ;         jl   fbcl1         ;clip
  82. ;         cmp  edi,320       ;clip
  83. ;         jge  fbcl1         ;clip
  84.  
  85.          mov  esi,DWORD PTR gs:YV[bx] ; y
  86.          add  esi,100
  87.          cmp  esi,0         ;clip
  88.          jl   fbcl1         ;clip
  89.          cmp  esi,200       ;clip
  90.          jge  fbcl1         ;clip
  91.  
  92.                             ; esi = y    PutPixel rout by Type One ....
  93.                             ; edi = x    
  94.  
  95.          mov     dx,3c5h
  96.          mov     si,WORD PTR [Ytable+esi*2]    ; take the Vertical Offset
  97.          add     si,WORD PTR [Xtable+edi*4+2]  ; take the Horizontal Offset
  98.          add     si,Dest                       ; base
  99.          mov     al,BYTE PTR [Xtable+edi*4]    ; take the corresponding plane
  100.          out     dx,al                         ; enable the right plane
  101.          mov     dl,BYTE PTR gs:VV[bx]
  102.          mov     BYTE PTR es:[si],dl           ; Write pixel onto screen
  103. Patch    LABEL   WORD
  104.          mov     WORD PTR gs:[bx+1234h],si     ; save adr. of dot
  105.  
  106.  
  107. fbcl1:
  108.          ;*****************************************************
  109.  
  110.          add  bx,4
  111.  
  112.          dec  cx
  113.          jnz  bcl1               ;+ rapide que le loop ?
  114.  
  115.          MPOP eax,ebx,cx,edx,esi,edi,ebp,es
  116.  
  117. endm
  118. ;*****************************************************************************
  119. transf3b  macro
  120.           local bcl1,fbcl1,Patch
  121.           MPUSH eax,ebx,cx,edx,esi,edi,ebp,es
  122.  
  123.          mov ax,0a000h
  124.          mov es,ax     ; video seg
  125.          mov dx,3c4h
  126.          mov al,2      ; select bitplane
  127.          out dx,al       
  128.   
  129.          mov  ax,savptr
  130.          mov  WORD PTR cs:[Patch+3],ax ; save coord buf
  131.  
  132.  
  133. ;**************
  134. ;rotation zy
  135. ;**************
  136.          mov  cx,nbdots
  137.          xor  bx,bx
  138. bcl1:    
  139.          ;agrandissement*****
  140.          mov  dl,agr
  141.          mov  al,BYTE PTR gs:XV[bx]
  142.          imul dl
  143.          cwde
  144.          mov  DWORD PTR gs:XV[bx],eax
  145.  
  146.          mov  al,BYTE PTR gs:YV[bx]
  147.          imul dl
  148.          cwde 
  149.          mov  DWORD PTR gs:YV[bx],eax
  150.  
  151.          mov  al,BYTE PTR gs:zV[bx]
  152.          imul dl
  153.          cwde
  154.          mov  DWORD PTR gs:zV[bx],eax
  155.          ;*******************
  156.  
  157.          mov    si,agl
  158.  
  159.          mov    edi,DWORD PTR gs:xv[bx]
  160.          imul   edi,DWORD PTR[cos+si]   ;edi=cos*x
  161.  
  162.          mov    eax,DWORD PTR gs:yv[bx]
  163.          imul   eax,DWORD PTR[sin+si]   ;eax=sin*y
  164.  
  165.          sub    edi,eax         ;edi:=edi-eax
  166.          sar    edi,8           ;edi:=edi /256
  167.          mov    ebp,edi         ;save:=x
  168.  
  169.          mov    edi,DWORD PTR gs:xv[bx]
  170.          imul   edi,DWORD PTR[sin+si]   ;edi=sin*x
  171.  
  172.          mov    eax,DWORD PTR gs:yv[bx]
  173.          imul   eax,DWORD PTR[cos+si]   ;eax=cos*y
  174.  
  175.          add    edi,eax         ;edi=edi+eax
  176.          sar    edi,8           ;edi=edi /256
  177.          mov    DWORD PTR gs:yv[bx],edi ;y=ok
  178.  
  179.          mov    DWORD PTR gs:xv[bx],ebp ;x=ok
  180.  
  181.          mov    edi,DWORD PTR gs:xv[bx]
  182.          imul   edi,DWORD PTR[cos+si]   ;edi=cos*x
  183.          mov    eax,DWORD PTR gs:zv[bx]
  184.          imul   eax,DWORD PTR[sin+si]   ;eax=sin*z
  185.          sub    edi,eax         ;edi=edi-eax
  186.          sar    edi,8           ;edi=edi /256
  187.          mov    DWORD PTR gs:xv[bx],edi ;x=ok
  188.       
  189.          ;viewdots**********************************************
  190.          mov  edi,DWORD PTR gs:XV[bx] ; x
  191.          add  edi,160
  192.        ;  cmp  edi,0         ;clip
  193.        ;  jl   fbcl1         ;clip
  194.        ;  cmp  edi,320       ;clip
  195.        ;  jge  fbcl1         ;clip
  196.  
  197.          mov  esi,DWORD PTR gs:YV[bx] ; y
  198.          add  esi,100
  199.          cmp  esi,0         ;clip
  200.          jl   fbcl1         ;clip
  201.          cmp  esi,200       ;clip
  202.          jge  fbcl1         ;clip
  203.  
  204.                             ; esi = y    PutPixel rout by Type One ....
  205.                             ; edi = x    
  206.  
  207.          mov     dx,3c5h
  208.          mov     si,WORD PTR [Ytable+esi*2]    ; take the Vertical Offset
  209.          add     si,WORD PTR [Xtable+edi*4+2]  ; take the Horizontal Offset
  210.          add     si,Dest                       ; base
  211.          mov     al,BYTE PTR [Xtable+edi*4]    ; take the corresponding plane
  212.          out     dx,al                         ; enable the right plane
  213.          mov     dl,BYTE PTR gs:VV[bx]
  214.          mov     BYTE PTR es:[si],dl           ; Write pixel onto screen
  215. Patch    LABEL   WORD
  216.          mov     WORD PTR gs:[bx+1234h],si     ; save adr. of dot
  217.  
  218.  
  219. fbcl1:
  220.          ;*****************************************************
  221.  
  222.          add  bx,4
  223.  
  224.          dec  cx
  225.          jnz  bcl1               ;+ rapide que le loop ?
  226.  
  227.          MPOP eax,ebx,cx,edx,esi,edi,ebp,es
  228.  
  229. endm
  230. ;*****************************************************************************
  231. transf3c  macro
  232.           local bcl1,fbcl1,Patch
  233.           MPUSH eax,ebx,cx,edx,esi,edi,ebp,es
  234.  
  235.          mov ax,0a000h
  236.          mov es,ax     ; video seg
  237.          mov dx,3c4h
  238.          mov al,2      ; select bitplane
  239.          out dx,al       
  240.   
  241.          mov  ax,savptr
  242.          mov  WORD PTR cs:[Patch+3],ax ; save coord buf
  243.  
  244.  
  245. ;**************
  246. ;rotation xy
  247. ;**************
  248.          mov  cx,nbdots
  249.          xor  bx,bx
  250.  
  251. bcl1:    
  252.          ;agrandissement*****
  253.          mov  dl,agr
  254.          mov  al,BYTE PTR gs:XV[bx]
  255.          imul dl
  256.          cwde 
  257.          mov  DWORD PTR gs:XV[bx],eax
  258.  
  259.          mov  al,BYTE PTR gs:YV[bx]
  260.          imul dl
  261.          cwde 
  262.          mov  DWORD PTR gs:YV[bx],eax
  263.  
  264.          mov  al,BYTE PTR gs:zV[bx]
  265.          imul dl
  266.          cwde
  267.          mov  DWORD PTR gs:zV[bx],eax
  268.  
  269.          ;*******************
  270.          mov    si,agl
  271.  
  272.          mov    edi,DWORD PTR gs:yv[bx]
  273.          imul   edi,DWORD PTR[cos+si]  ;edi=cos*y
  274.  
  275.          mov    eax,DWORD PTR gs:zv[bx]
  276.          imul   eax,DWORD PTR[sin+si]  ;eax=sin*z
  277.  
  278.          sub    edi,eax         ;edi=edi-eax
  279.          sar    edi,8           ;edi=edi /256
  280.          mov    ebp,edi         ;y=ok
  281.  
  282.          mov    edi,DWORD PTR gs:yv[bx]
  283.          imul   edi,DWORD PTR[sin+si]  ;edi=sin*y
  284.  
  285.          mov    eax,DWORD PTR gs:zv[bx]
  286.          imul   eax,DWORD PTR[cos+si]  ;eax=cos*z
  287.  
  288.          add    edi,eax         ;edi=edi+eax
  289.          sar    edi,8           ;edi=edi /256
  290.          mov    DWORD PTR gs:zv[bx],edi ;z=ok
  291.          mov    DWORD PTR gs:yv[bx],ebp ;y=ok
  292.  
  293.          mov    edi,DWORD PTR gs:xv[bx]
  294.          imul   edi,DWORD PTR[cos+si]  ;edi=cos*x
  295.  
  296.          mov    eax,DWORD PTR gs:zv[bx]
  297.          imul   eax,DWORD PTR[sin+si]  ;eax=sin*z
  298.          sub    edi,eax         ;edi=edi-eax
  299.          sar    edi,8           ;edi=edi /256
  300.          mov    DWORD PTR gs:xv[bx],edi ;x=ok
  301.       
  302.          ;viewdots**********************************************
  303.          mov  edi,DWORD PTR gs:XV[bx] ; x
  304.          add  edi,160
  305.       ;   cmp  edi,0         ;clip
  306.       ;   jl   fbcl1         ;clip
  307.       ;   cmp  edi,320       ;clip
  308.       ;   jge  fbcl1         ;clip
  309.  
  310.          mov  esi,DWORD PTR gs:YV[bx] ; y
  311.          add  esi,100
  312.          cmp  esi,0         ;clip
  313.          jl   fbcl1         ;clip
  314.          cmp  esi,200       ;clip
  315.          jge  fbcl1         ;clip
  316.  
  317.                             ; esi = y    PutPixel rout by Type One ....
  318.                             ; edi = x    
  319.  
  320.          mov     dx,3c5h
  321.          mov     si,WORD PTR [Ytable+esi*2]    ; take the Vertical Offset
  322.          add     si,WORD PTR [Xtable+edi*4+2]  ; take the Horizontal Offset
  323.          add     si,Dest                       ; base
  324.          mov     al,BYTE PTR [Xtable+edi*4]    ; take the corresponding plane
  325.          out     dx,al                         ; enable the right plane
  326.          mov     dl,BYTE PTR gs:VV[bx]
  327.          mov     BYTE PTR es:[si],dl           ; Write pixel onto screen
  328. Patch    LABEL   WORD
  329.          mov     WORD PTR gs:[bx+1234h],si     ; save adr. of dot
  330.  
  331.  
  332. fbcl1:
  333.          ;*****************************************************
  334.  
  335.          add bx,4
  336.  
  337.          dec  cx
  338.          jnz  bcl1           ;+ rapide que le loop ?
  339.  
  340.          MPOP eax,ebx,cx,edx,esi,edi,ebp,es
  341.  
  342. endm
  343. ;*****************************************************************************
  344.